#[RUN: /env/gfs/Projects/yshen/21_SophieMS_Iseq100/Papier/Script/pipe_UMI_Prism_MS.sh NextSeq2_16Cycles-III_S10_R1.fastq.gz NextSeq2_16Cycles-III_S10_R2.fastq.gz 142 133 NextSeq2_16Cycles-III_S10 ]
# ========= [INFO] ==========
# Read 1 : NextSeq2_16Cycles-III_S10_R1.fastq.gz
# Read 2 : NextSeq2_16Cycles-III_S10_R2.fastq.gz
# Len_R1 : 142
# Len_R2 : 133
# ID Name: NextSeq2_16Cycles-III_S10
# LogFile: NextSeq2_16Cycles-III_S10.log
# R_Struc: 8M134T 8M125T
# RefGene: /env/gnfs/Projects/DETECT_SENSI_MSI/Papier//Ref/RefAllMSSeq/refMS2PhiX2.fa
# ModeUMI: duplex
# TypeGrpByUMI: paired
# maxMutInUMI : 0
# =============================
#
====== [ To BAM add UMI Info] ====== 
> java -jar /env/gfs/apps/picard/2.8.2/picard.jar FastqToSam FASTQ=NextSeq2_16Cycles-III_S10_R1.fastq.gz FASTQ2=NextSeq2_16Cycles-III_S10_R2.fastq.gz O=NextSeq2_16Cycles-III_S10.unmapped.bam SM=NextSeq2_16Cycles-III_S10
[Creat: NextSeq2_16Cycles-III_S10.unmapped.bam ]
java -jar /env/gfs/apps/fgbio/2.0.2/fgbio.jar ExtractUmisFromBam --input=NextSeq2_16Cycles-III_S10.unmapped.bam --output=NextSeq2_16Cycles-III_S10.unmapped.withUMI.bam --read-structure=8M134T 8M125T --molecular-index-tags=ZA ZB --single-tag=RX
====== [ Mapp Reads/BWA ] ====== 
> samtools fastq NextSeq2_16Cycles-III_S10.unmapped.withUMI.bam |  bwa mem -t 8 -p -k 10 /env/gnfs/Projects/DETECT_SENSI_MSI/Papier//Ref/RefAllMSSeq/refMS2PhiX2.fa  /dev/stdin | samtools view -bS > NextSeq2_16Cycles-III_S10.mapped.withUMI.bam
> java -jar /env/gfs/apps/picard/2.8.2/picard.jar MergeBamAlignment R=/env/gnfs/Projects/DETECT_SENSI_MSI/Papier//Ref/RefAllMSSeq/refMS2PhiX2.fa 
    UNMAPPED_BAM=NextSeq2_16Cycles-III_S10.unmapped.withUMI.bam  ALIGNED_BAM=NextSeq2_16Cycles-III_S10.mapped.withUMI.bam O=NextSeq2_16Cycles-III_S10.merged.withUMI.bam  
    CREATE_INDEX=true  MAX_GAPS=-1 ALIGNER_PROPER_PAIR_FLAGS=true 
    VALIDATION_STRINGENCY=SILENT SO=coordinate ATTRIBUTES_TO_RETAIN=XS ORIENTATIONS=FR
[Creat: NextSeq2_16Cycles-III_S10.merged.withUMI.bam ]
====== [ Call Consensus Reads ] === < 1.Group Reads By Umi >
> java -jar /env/gfs/apps/fgbio/2.0.2/fgbio.jar GroupReadsByUmi --input=NextSeq2_16Cycles-III_S10.merged.withUMI.bam --output=NextSeq2_16Cycles-III_S10.merged.withUMI.group.bam --strategy=paired  --edits=0 --min-map-q=10  --raw-tag=RX 
[Creat: NextSeq2_16Cycles-III_S10.merged.withUMI.group.bam ]
====== [ Call Consensus Reads ] === < 2. Call Molecular Consensus Reads >
> java -jar /env/gfs/apps/fgbio/2.0.2/fgbio.jar  CallDuplexConsensusReads  --min-input-base-quality=10  --input=NextSeq2_16Cycles-III_S10.merged.withUMI.group.bam   --output=NextSeq2_16Cycles-III_S10.merged.withUMI.group.consensusUnmapp.bam --error-rate-pre-umi=45 --error-rate-post-umi=30
[Creat: NextSeq2_16Cycles-III_S10.merged.withUMI.group.consensusUnmapp.bam ]
>samtools view NextSeq2_16Cycles-III_S10.merged.withUMI.group.consensusUnmapp.bam | cut -f10 > NextSeq2_16Cycles-III_S10.merged.withUMI.group.consensusUnmapp.seq
[Creat: NextSeq2_16Cycles-III_S10.merged.withUMI.group.consensusUnmapp.seq ]
========[ END ]========
